﻿package com.gambit.happilyeverafter.characters {
	import org.flixel.FlxSprite;
	import org.flixel.FlxG;
	
	/**
	 * ...
	 * @author William Hutama
	 */
	public class Ninja extends BaseCharacter {
		
		[Embed(source = "../../../../data/small/ninja_small.png")]
		private var NinjaImage:Class;
		
		private var _jump_power:int = 800;
		
		public function Ninja(x:Number, y:Number) {
			super(NinjaImage, x, y);
			
			_move_speed = 1000;
			maxVelocity.x = 150;
			maxVelocity.y = 200;
			health = 10;
			
			// gravity
			acceleration.y = 320;
			drag.x = 500;
			width = 32;
			height = 32;
			
			addAnimation("walk", [0], 10);
			addAnimation("stopped", [0], 10);
			facing = RIGHT;
		}
		
		override public function update():void {
			
			
			if (FlxG.keys.justPressed("X")) {
				if (velocity.y == 0) {
					velocity.y = - _jump_power;
				}
			}
			// animation
			if (velocity.x == 0) {
				play("stopped");
			}
			else {
				play("walk");
			}
			super.update();
		}
		
		//override public function hitFloor(Contact:FlxCore):Boolean {
			//return true;
		//}
		
	}

}